<?php

	if( extension_loaded( 'gettext')) {
		require_once("library/localization.php");
	}
	
	include("library/vars.php");
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title><?php echo _("TV Shows"); ?></title>
	<meta name="author" content="Ivo Gomes" />
	<meta name="description" content="TV Shows management application. Keeps track of every show you have, and what episodes you have seen (or not) and also if you have subtitles for the episode (or not)." />
	<meta name="keywords" content="tv, shows, tvshows, subtitles, seen, unseen, séries, legendas" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script src="library/js/jquery.js" type="text/javascript"></script>
	<script src="library/js/jquery.filestyle.pack.js" type="text/javascript"></script>
	<script src="library/js/jquery.validate.js" type="text/javascript"></script>
	<script src="library/js/jquery.metadata.js" type="text/javascript"></script>
	<script src="library/js/jquery.quicksearch.js" type="text/javascript"></script>
	<script src="library/js/jquery.bgiframe.min.js" type="text/javascript"></script>
	<script src="library/js/jquery.dimensions.js" type="text/javascript"></script>
	<script src="library/js/jquery.ajaxQueue.js" type="text/javascript"></script>
	<script src="library/js/jquery.autocomplete.js" type="text/javascript"></script>
	<script src="library/js/localdata.js" type="text/javascript"></script>
	<script src="library/js/reflection.js" type="text/javascript"></script>
	<script src="library/js/jquery.blockUI.js" type="text/javascript"></script>
	<script type="text/javascript" src="library/js/tvshows.js"></script>
	<link rel="stylesheet" href="library/css/style.css?tvs094" type="text/css" media="screen" />
	<link rel="stylesheet" href="library/css/print.css?tvs094" type="text/css" media="print" />
	<link rel="stylesheet" href="library/js/jquery.autocomplete.css" type="text/css" />
	<!--[if lt IE 7]>
	<link rel="stylesheet" href="library/css/ie-hacks.css" type="text/css" media="screen" title="IE hacks">
	<![endif]-->
	<!--[if IE 7]>
	<link rel="stylesheet" href="library/css/ie7-hacks.css" type="text/css" media="screen" title="IE hacks">
	<![endif]-->
	
</head>

<body>
	
	<div id="sidebar">
		<div id="logo">
			<h1><a href="index.php"><?php echo _("TV Shows"); ?></a><span>1.0</span></h1>
		</div>
		<?php
			// Get the list of all shows
			include("library/config.php");
			include("library/opendb.php");
		
			$query="SELECT id, show_name, show_nicename, path FROM shows ORDER BY show_name ASC";
			$result = mysql_query($query);
			$totalshows=mysql_numrows($result);	
			
			echo '<ul>';
				while(list($show_id,$show_name,$show_nicename,$path)= mysql_fetch_row($result)) {
				
					echo '<li';
						if ($show == $show_nicename) { // Change class if the show is selected
							echo ' class="selected"';
						}
					echo '><a href="index.php?s=' . $show_nicename . '">' . $show_name . '</a></li>
					';
				}


			$query3="SELECT show_ID, season_ID, episode, title, description, seen, subs FROM episodes WHERE seen='0'";
			$result3 = mysql_query($query3);
			$numtotal=mysql_numrows($result3);
						
			if ($totalshows > 0) {	
			
				echo '<li ';
					if ($show == "all") { // Change class if we're on the Show All Unseen page
						echo 'class="selected" ';
					}
			
				echo 'id="show_unplayed"><a href="unseen.php?s=all">'._("All Unseen Episodes").'';
				if ($numtotal > 0) {
					echo ' <span class="total"><strong>'. $numtotal .'</strong></span>';
				}
				
				echo '</a></li>';
			}
			echo '
			</ul>	
		
			<p class="add"><a href="add_show.php">'._("Add New Show").'</a></p>';
		
			mysql_free_result($result);
			include("library/closedb.php"); 
			
			if( extension_loaded( 'gettext')) { ?>
			
			
			<?php } ?>
	
	</div>